#!/bin/bash

if [ -L $0 ] ; then
	EXEC="$(readlink $0)"
else
	EXEC="$0"
fi

DIR="$( cd -L $( dirname "$EXEC" ) && pwd )"

EXPLOCATION="$1"

EXPTYPE="$2"

ENVFILE=$DIR/env.sh

DEPLOYDIR=$DIR/deployment/$EXPLOCATION

case $EXPTYPE in
	elasticmigration | elasticreplication | migration | nomigration | replication | noreplication )
		cp $DEPLOYDIR/$EXPTYPE/experiment-variables.sh $DIR
		cp $DEPLOYDIR/$EXPTYPE/expMiddleware.jmx $DIR
		#echo $DEPLOYDIR/$EXPTYPE/experiment-variables.sh
		#echo $DEPLOYDIR/$EXPTYPE/expMiddleware.jmx		
		echo "export EXPLOCATION=$EXPLOCATION" > $ENVFILE
		echo "export EXPTYPE=$EXPTYPE" >> $ENVFILE
		;;
	*)
		echo "Usage: set-environment.sh [local|aws] [migration|nomigration|replication|noreplication]"
		exit 1
		;;
esac


